# -*- coding:utf-8 -*-
import django.utils.timezone as timezone
from django.contrib.auth.models import AbstractUser,Group
from django.db import models

from libs.base.basedb import Basemodel


class User(AbstractUser):
    gender_type = (
        ("0", "女"), ("1", "男")
    )
    groups = models.ManyToManyField(Group, verbose_name='用户组', related_name='users'),
    register_date = models.DateTimeField(verbose_name='保存日期', default=timezone.now)
    mobile = models.CharField(null=True, blank=True, max_length=11, verbose_name="电话")
    gender = models.CharField(max_length=3, choices=gender_type, default="0", verbose_name="性别")
    name = models.CharField(null=True, max_length=11, verbose_name='姓名')
    birthday = models.DateField(null=True, blank=True, verbose_name="出生年月")
    email = models.EmailField(max_length=100, null=True, blank=True, verbose_name="邮箱")
    goods_front_image = models.ImageField(upload_to="user/images/", null=True, blank=True, verbose_name="头像")
    class Meta:
        verbose_name = "用户"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.username



